from django.shortcuts import render_to_response
from google.appengine.api import users
from google.appengine.ext.db import Query
from garnirechi.admin.models import WebContent, MAIN, ABOUT
import logging

def main(request):
    content = ''
    result = Query(WebContent).filter('type =', MAIN).fetch(1)
    if(len(result)==1):
        content=result[0].content
    logging.debug('Main content: %s' % (content))
    return render_to_response("index.html", {"content":content})

def shop(request):
    return render_to_response("shop.html", {})

def about(request):
    content = ''
    result = Query(WebContent).filter('type =', ABOUT).fetch(1)
    if(len(result)==1):
        content=result[0].content
    logging.debug('Main content: %s' % (content))
    return render_to_response("about.html", {"content":content})

def workshop(request):
    return render_to_response("workshop.html", {})

